import request from "@/plugins/request/request_dic.js";

// 查询多个人员详情
export function queryMultiStaffDetail(staffIds) {
  return request({
    url: `/support/orgStaff/queryOrgStaffMap`,
    method: "post",
    data: staffIds,
  });
}

// 查询单个人员详情
export function queryStaffDetail(staffId) {
  return request({
    url: `/support/orgStaff/queryByStaffId?staffId=${staffId}`,
    method: "get",
  });
}

// 根据条件进行人员查询
export function queryStaffByKeyword(data) {
  return request({
    url: `/support/orgStaff/queryOrgStaffs`,
    method: "post",
    data: {
      dataStatus: 1,
      ...data
    }
  });
}

// 查询单个单位详情
export function queryOrgDetail(orgId) {
  return request({
    url: `/support/org/queryByOrgId?orgId=${orgId}`,
    method: "get",
  });
}

// 查询多个单位详情
export function queryMultiOrgDetail(orgIds) {
  return request({
    url: `/support/org/queryOrgMap`,
    method: "post",
    data: orgIds,
  });
}

// 获取业务组织树子节点（不递归）, treeType树类型：1-单位部门树；2-单位树；3-单位部门人员树；4-组织角色树
export function orgAsynTree(pOrgId, treeType = "1") {
  return request({
    url: `/support/org/component/children/list?pOrgId=${pOrgId}&treeType=${treeType}`,
    method: "get",
  });
}

// 业务数据查询功能根据单位树条件筛选，获取单位树第一级节点
export function queryTreeList(orgId = "", treeType = "1") {
  let params = orgId ? `&orgId=${orgId}` : "";
  return request({
    url: `/support/org/component/top/list?treeType=${treeType}` + params,
    method: "get",
  });
}

// 单位部门按列表查询（部门：DEPT；单位：CORP）
export function queryOrgByKeyword(data, natureCode = "CORP") {
  return request({
    url: `/support/org/queryOrgs`,
    method: "post",
    data: {
      ...data,
      natureCode,
    },
  });
}
